package com.xr.core.system.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/trigger")
public class TriggerController {

    private final RabbitTemplate rabbitTemplate;

    private final Queue queue;

    @GetMapping("/sendMessage")
    public void sendMessage(String msg) {
        rabbitTemplate.convertAndSend(queue.getName(), msg);
    }

}
